package com.luhuiguo.cms.client.ui;

import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.luhuiguo.cms.client.GlobalConstants;
import com.luhuiguo.cms.client.GlobalMessages;
import com.luhuiguo.cms.client.presenter.MainPresenter;

@Singleton
public class MainView extends LayoutContainer implements MainPresenter.Display {

    @SuppressWarnings("unused")
    private GlobalConstants constants;

    @SuppressWarnings("unused")
    private GlobalMessages messages;

    @Inject
    public MainView(GlobalConstants constants, GlobalMessages messages) {
        super();

        this.constants = constants;
        this.messages = messages;
        setLayout(new FitLayout());

    }

    @Override
    public Widget asWidget() {
        return this;
    }

    @Override
    public void addWidget(Widget widget) {
    }

    @Override
    public void removeWidget(Widget widget) {
    }

    @Override
    public void showWidget(Widget widget) {
        removeAll();
        add(widget);
        layout();

    }

}
